
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/solvers/inequalities.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:24:27 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Inequality Solvers &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../live.sympy.org/static/live-sphinx.js"></script>
    
    <link rel="shortcut icon" href="../../_static/sympy-notailtext-favicon.ico"/>
    <link href="inequalities.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Integrals" href="../integrals/integrals.html" />
    <link rel="prev" title="Internal API" href="../holonomic/internal.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../integrals/integrals.html" title="Integrals"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../holonomic/internal.html" title="Internal API"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" accesskey="U">SymPy Modules Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Inequality Solvers</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="module-sympy.solvers.inequalities">
<span id="inequality-solvers"></span><span id="inequality-docs"></span><h1>Inequality Solvers<a class="headerlink" href="#module-sympy.solvers.inequalities" title="Permalink to this headline">¶</a></h1>
<dl class="py function">
<dt class="sig sig-object py" id="sympy.solvers.inequalities.solve_rational_inequalities">
<span class="sig-prename descclassname"><span class="pre">sympy.solvers.inequalities.</span></span><span class="sig-name descname"><span class="pre">solve_rational_inequalities</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">eqs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/solvers/inequalities.py#L130-L194"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.solvers.inequalities.solve_rational_inequalities" title="Permalink to this definition">¶</a></dt>
<dd><p>Solve a system of rational inequalities with rational coefficients.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Poly</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.solvers.inequalities</span> <span class="kn">import</span> <span class="n">solve_rational_inequalities</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">solve_rational_inequalities</span><span class="p">([[</span>
<span class="gp">... </span><span class="p">((</span><span class="n">Poly</span><span class="p">(</span><span class="o">-</span><span class="n">x</span> <span class="o">+</span> <span class="mi">1</span><span class="p">),</span> <span class="n">Poly</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">)),</span> <span class="s1">&#39;&gt;=&#39;</span><span class="p">),</span>
<span class="gp">... </span><span class="p">((</span><span class="n">Poly</span><span class="p">(</span><span class="o">-</span><span class="n">x</span> <span class="o">+</span> <span class="mi">1</span><span class="p">),</span> <span class="n">Poly</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">)),</span> <span class="s1">&#39;&lt;=&#39;</span><span class="p">)]])</span>
<span class="go">{1}</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">solve_rational_inequalities</span><span class="p">([[</span>
<span class="gp">... </span><span class="p">((</span><span class="n">Poly</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">Poly</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">)),</span> <span class="s1">&#39;!=&#39;</span><span class="p">),</span>
<span class="gp">... </span><span class="p">((</span><span class="n">Poly</span><span class="p">(</span><span class="o">-</span><span class="n">x</span> <span class="o">+</span> <span class="mi">1</span><span class="p">),</span> <span class="n">Poly</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">)),</span> <span class="s1">&#39;&gt;=&#39;</span><span class="p">)]])</span>
<span class="go">Union(Interval.open(-oo, 0), Interval.Lopen(0, 1))</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.solvers.inequalities.solve_poly_inequality" title="sympy.solvers.inequalities.solve_poly_inequality"><code class="xref py py-obj docutils literal notranslate"><span class="pre">solve_poly_inequality</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.solvers.inequalities.solve_poly_inequality">
<span class="sig-prename descclassname"><span class="pre">sympy.solvers.inequalities.</span></span><span class="sig-name descname"><span class="pre">solve_poly_inequality</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">poly</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rel</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/solvers/inequalities.py#L20-L109"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.solvers.inequalities.solve_poly_inequality" title="Permalink to this definition">¶</a></dt>
<dd><p>Solve a polynomial inequality with rational coefficients.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Poly</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.solvers.inequalities</span> <span class="kn">import</span> <span class="n">solve_poly_inequality</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">solve_poly_inequality</span><span class="p">(</span><span class="n">Poly</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">domain</span><span class="o">=</span><span class="s1">&#39;ZZ&#39;</span><span class="p">),</span> <span class="s1">&#39;==&#39;</span><span class="p">)</span>
<span class="go">[{0}]</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">solve_poly_inequality</span><span class="p">(</span><span class="n">Poly</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">domain</span><span class="o">=</span><span class="s1">&#39;ZZ&#39;</span><span class="p">),</span> <span class="s1">&#39;!=&#39;</span><span class="p">)</span>
<span class="go">[Interval.open(-oo, -1), Interval.open(-1, 1), Interval.open(1, oo)]</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">solve_poly_inequality</span><span class="p">(</span><span class="n">Poly</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">domain</span><span class="o">=</span><span class="s1">&#39;ZZ&#39;</span><span class="p">),</span> <span class="s1">&#39;==&#39;</span><span class="p">)</span>
<span class="go">[{-1}, {1}]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.solvers.inequalities.solve_poly_inequalities" title="sympy.solvers.inequalities.solve_poly_inequalities"><code class="xref py py-obj docutils literal notranslate"><span class="pre">solve_poly_inequalities</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.solvers.inequalities.solve_poly_inequalities">
<span class="sig-prename descclassname"><span class="pre">sympy.solvers.inequalities.</span></span><span class="sig-name descname"><span class="pre">solve_poly_inequalities</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">polys</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/solvers/inequalities.py#L112-L127"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.solvers.inequalities.solve_poly_inequalities" title="Permalink to this definition">¶</a></dt>
<dd><p>Solve polynomial inequalities with rational coefficients.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.solvers.inequalities</span> <span class="kn">import</span> <span class="n">solve_poly_inequalities</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys</span> <span class="kn">import</span> <span class="n">Poly</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">solve_poly_inequalities</span><span class="p">(((</span>
<span class="gp">... </span><span class="n">Poly</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">-</span> <span class="mi">3</span><span class="p">),</span> <span class="s2">&quot;&gt;&quot;</span><span class="p">),</span> <span class="p">(</span>
<span class="gp">... </span><span class="n">Poly</span><span class="p">(</span><span class="o">-</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">),</span> <span class="s2">&quot;&gt;&quot;</span><span class="p">)))</span>
<span class="go">Union(Interval.open(-oo, -sqrt(3)), Interval.open(-1, 1), Interval.open(sqrt(3), oo))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.solvers.inequalities.reduce_rational_inequalities">
<span class="sig-prename descclassname"><span class="pre">sympy.solvers.inequalities.</span></span><span class="sig-name descname"><span class="pre">reduce_rational_inequalities</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">exprs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gen</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">relational</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/solvers/inequalities.py#L197-L284"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.solvers.inequalities.reduce_rational_inequalities" title="Permalink to this definition">¶</a></dt>
<dd><p>Reduce a system of rational inequalities with rational coefficients.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.solvers.inequalities</span> <span class="kn">import</span> <span class="n">reduce_rational_inequalities</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">real</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">reduce_rational_inequalities</span><span class="p">([[</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">]],</span> <span class="n">x</span><span class="p">)</span>
<span class="go">Eq(x, 0)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">reduce_rational_inequalities</span><span class="p">([[</span><span class="n">x</span> <span class="o">+</span> <span class="mi">2</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">]],</span> <span class="n">x</span><span class="p">)</span>
<span class="go">-2 &lt; x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">reduce_rational_inequalities</span><span class="p">([[(</span><span class="n">x</span> <span class="o">+</span> <span class="mi">2</span><span class="p">,</span> <span class="s2">&quot;&gt;&quot;</span><span class="p">)]],</span> <span class="n">x</span><span class="p">)</span>
<span class="go">-2 &lt; x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">reduce_rational_inequalities</span><span class="p">([[</span><span class="n">x</span> <span class="o">+</span> <span class="mi">2</span><span class="p">]],</span> <span class="n">x</span><span class="p">)</span>
<span class="go">Eq(x, -2)</span>
</pre></div>
</div>
<p>This function find the non-infinite solution set so if the unknown symbol
is declared as extended real rather than real then the result may include
finiteness conditions:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">y</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;y&#39;</span><span class="p">,</span> <span class="n">extended_real</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">reduce_rational_inequalities</span><span class="p">([[</span><span class="n">y</span> <span class="o">+</span> <span class="mi">2</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">]],</span> <span class="n">y</span><span class="p">)</span>
<span class="go">(-2 &lt; y) &amp; (y &lt; oo)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.solvers.inequalities.reduce_abs_inequality">
<span class="sig-prename descclassname"><span class="pre">sympy.solvers.inequalities.</span></span><span class="sig-name descname"><span class="pre">reduce_abs_inequality</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rel</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gen</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/solvers/inequalities.py#L287-L366"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.solvers.inequalities.reduce_abs_inequality" title="Permalink to this definition">¶</a></dt>
<dd><p>Reduce an inequality with nested absolute values.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Abs</span><span class="p">,</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.solvers.inequalities</span> <span class="kn">import</span> <span class="n">reduce_abs_inequality</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">real</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">reduce_abs_inequality</span><span class="p">(</span><span class="n">Abs</span><span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="mi">5</span><span class="p">)</span> <span class="o">-</span> <span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;&lt;&#39;</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
<span class="go">(2 &lt; x) &amp; (x &lt; 8)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">reduce_abs_inequality</span><span class="p">(</span><span class="n">Abs</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="mi">2</span><span class="p">)</span><span class="o">*</span><span class="mi">3</span> <span class="o">-</span> <span class="mi">13</span><span class="p">,</span> <span class="s1">&#39;&lt;&#39;</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
<span class="go">(-19/3 &lt; x) &amp; (x &lt; 7/3)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.solvers.inequalities.reduce_abs_inequalities" title="sympy.solvers.inequalities.reduce_abs_inequalities"><code class="xref py py-obj docutils literal notranslate"><span class="pre">reduce_abs_inequalities</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.solvers.inequalities.reduce_abs_inequalities">
<span class="sig-prename descclassname"><span class="pre">sympy.solvers.inequalities.</span></span><span class="sig-name descname"><span class="pre">reduce_abs_inequalities</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">exprs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gen</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/solvers/inequalities.py#L369-L392"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.solvers.inequalities.reduce_abs_inequalities" title="Permalink to this definition">¶</a></dt>
<dd><p>Reduce a system of inequalities with nested absolute values.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Abs</span><span class="p">,</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.solvers.inequalities</span> <span class="kn">import</span> <span class="n">reduce_abs_inequalities</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">extended_real</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">reduce_abs_inequalities</span><span class="p">([(</span><span class="n">Abs</span><span class="p">(</span><span class="mi">3</span><span class="o">*</span><span class="n">x</span> <span class="o">-</span> <span class="mi">5</span><span class="p">)</span> <span class="o">-</span> <span class="mi">7</span><span class="p">,</span> <span class="s1">&#39;&lt;&#39;</span><span class="p">),</span>
<span class="gp">... </span><span class="p">(</span><span class="n">Abs</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="mi">25</span><span class="p">)</span> <span class="o">-</span> <span class="mi">13</span><span class="p">,</span> <span class="s1">&#39;&gt;&#39;</span><span class="p">)],</span> <span class="n">x</span><span class="p">)</span>
<span class="go">(-2/3 &lt; x) &amp; (x &lt; 4) &amp; (((-oo &lt; x) &amp; (x &lt; -38)) | ((-12 &lt; x) &amp; (x &lt; oo)))</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">reduce_abs_inequalities</span><span class="p">([(</span><span class="n">Abs</span><span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="mi">4</span><span class="p">)</span> <span class="o">+</span> <span class="n">Abs</span><span class="p">(</span><span class="mi">3</span><span class="o">*</span><span class="n">x</span> <span class="o">-</span> <span class="mi">5</span><span class="p">)</span> <span class="o">-</span> <span class="mi">7</span><span class="p">,</span> <span class="s1">&#39;&lt;&#39;</span><span class="p">)],</span> <span class="n">x</span><span class="p">)</span>
<span class="go">(1/2 &lt; x) &amp; (x &lt; 4)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.solvers.inequalities.reduce_abs_inequality" title="sympy.solvers.inequalities.reduce_abs_inequality"><code class="xref py py-obj docutils literal notranslate"><span class="pre">reduce_abs_inequality</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.solvers.inequalities.reduce_inequalities">
<span class="sig-prename descclassname"><span class="pre">sympy.solvers.inequalities.</span></span><span class="sig-name descname"><span class="pre">reduce_inequalities</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inequalities</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">symbols</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">[]</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/solvers/inequalities.py#L952-L1009"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.solvers.inequalities.reduce_inequalities" title="Permalink to this definition">¶</a></dt>
<dd><p>Reduce a system of inequalities with rational coefficients.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.solvers.inequalities</span> <span class="kn">import</span> <span class="n">reduce_inequalities</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">reduce_inequalities</span><span class="p">(</span><span class="mi">0</span> <span class="o">&lt;=</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">3</span><span class="p">,</span> <span class="p">[])</span>
<span class="go">(-3 &lt;= x) &amp; (x &lt; oo)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">reduce_inequalities</span><span class="p">(</span><span class="mi">0</span> <span class="o">&lt;=</span> <span class="n">x</span> <span class="o">+</span> <span class="n">y</span><span class="o">*</span><span class="mi">2</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="p">[</span><span class="n">x</span><span class="p">])</span>
<span class="go">(x &lt; oo) &amp; (x &gt;= 1 - 2*y)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.solvers.inequalities.solve_univariate_inequality">
<span class="sig-prename descclassname"><span class="pre">sympy.solvers.inequalities.</span></span><span class="sig-name descname"><span class="pre">solve_univariate_inequality</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gen</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">relational</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">domain</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">Reals</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">continuous</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/solvers/inequalities.py#L395-L692"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.solvers.inequalities.solve_univariate_inequality" title="Permalink to this definition">¶</a></dt>
<dd><p>Solves a real univariate inequality.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>expr</strong> : Relational</p>
<blockquote>
<div><p>The target inequality</p>
</div></blockquote>
<p><strong>gen</strong> : Symbol</p>
<blockquote>
<div><p>The variable for which the inequality is solved</p>
</div></blockquote>
<p><strong>relational</strong> : bool</p>
<blockquote>
<div><p>A Relational type output is expected or not</p>
</div></blockquote>
<p><strong>domain</strong> : Set</p>
<blockquote>
<div><p>The domain over which the equation is solved</p>
</div></blockquote>
<p><strong>continuous: bool</strong></p>
<blockquote>
<div><p>True if expr is known to be continuous over the given domain
(and so continuous_domain() doesn’t need to be called on it)</p>
</div></blockquote>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>NotImplementedError</strong></p>
<blockquote>
<div><p>The solution of the inequality cannot be determined due to limitation
in <a class="reference internal" href="solveset.html#sympy.solvers.solveset.solvify" title="sympy.solvers.solveset.solvify"><code class="xref py py-func docutils literal notranslate"><span class="pre">sympy.solvers.solveset.solvify()</span></code></a>.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Currently, we cannot solve all the inequalities due to limitations in
<a class="reference internal" href="solveset.html#sympy.solvers.solveset.solvify" title="sympy.solvers.solveset.solvify"><code class="xref py py-func docutils literal notranslate"><span class="pre">sympy.solvers.solveset.solvify()</span></code></a>. Also, the solution returned for trigonometric inequalities
are restricted in its periodic interval.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.solvers.inequalities</span> <span class="kn">import</span> <span class="n">solve_univariate_inequality</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span><span class="p">,</span> <span class="n">sin</span><span class="p">,</span> <span class="n">Interval</span><span class="p">,</span> <span class="n">S</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">solve_univariate_inequality</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">&gt;=</span> <span class="mi">4</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
<span class="go">((2 &lt;= x) &amp; (x &lt; oo)) | ((x &lt;= -2) &amp; (-oo &lt; x))</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">solve_univariate_inequality</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">&gt;=</span> <span class="mi">4</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">relational</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="go">Union(Interval(-oo, -2), Interval(2, oo))</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">domain</span> <span class="o">=</span> <span class="n">Interval</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">S</span><span class="o">.</span><span class="n">Infinity</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">solve_univariate_inequality</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">&gt;=</span> <span class="mi">4</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="kc">False</span><span class="p">,</span> <span class="n">domain</span><span class="p">)</span>
<span class="go">Interval(2, oo)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">solve_univariate_inequality</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">relational</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="go">Interval.open(0, pi)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="solveset.html#sympy.solvers.solveset.solvify" title="sympy.solvers.solveset.solvify"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.solvers.solveset.solvify</span></code></a></dt><dd><p>solver returning solveset solutions with solve’s output API</p>
</dd>
</dl>
</div>
</dd></dl>

</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="../holonomic/internal.html"
                        title="previous chapter">Internal API</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../integrals/integrals.html"
                        title="next chapter">Integrals</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/modules/solvers/inequalities.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../integrals/integrals.html" title="Integrals"
             >next</a> |</li>
        <li class="right" >
          <a href="../holonomic/internal.html" title="Internal API"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Inequality Solvers</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/solvers/inequalities.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:24:27 GMT -->
</html>